﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BackData
{
    public class APIResult<T>
    {
        public StateCode Code { get; set; }  // 状态码
        public T Result { get; set; }  // 结果
        public string Message { get; set; } // 消息

        public static APIResult<T> Ok(string message,T result)
        {
            return new APIResult<T>()
            {
                Code = StateCode.OK,
                Message = message,
                Result = result
            };
        }

        public static APIResult<T> Faile(string message)
        {
            return new APIResult<T>()
            {
                Code = StateCode.Fail,
                Message = message,
            };
        }
    }
}
